package com.jet.merchant.gate;

import com.jet.core.result.ResultJson;
import com.jet.merchant.domain.vo.AccountDetailVo;
import com.jet.merchant.domain.vo.UserVo;
import com.jet.merchant.service.IClerkAccountService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author dcl
 * @date 2023-02-21 10:46:33
 */
@RestController
@RequestMapping("/gate/v2/clerk/account")
public class GateV2AccountController {

    private final IClerkAccountService clerkAccountService;

    public GateV2AccountController(IClerkAccountService clerkAccountService) {
        this.clerkAccountService = clerkAccountService;
    }

    /**
     * 商户信息
     *
     * @param merchantNo
     * @param storeNo
     * @param accountId
     * @return
     */
    @GetMapping("/detail")
    public ResultJson<AccountDetailVo> merchantDetail(@RequestHeader long merchantNo,
                                                      @RequestHeader long storeNo,
                                                      @RequestHeader String accountId) {
        return ResultJson.ok(clerkAccountService.detail(merchantNo, storeNo, accountId));
    }


    /**
     * 切换门店
     *
     * @param merchantNo
     * @param storeNo
     * @param accountId
     * @param checkStoreNo
     * @return
     */
    @PutMapping("/check/{checkStoreNo}")
    public ResultJson<Void> checkStore(@RequestHeader long merchantNo,
                                       @RequestHeader long storeNo,
                                       @RequestHeader String accountId,
                                       @PathVariable long checkStoreNo) {
        clerkAccountService.checkStore(merchantNo, accountId, checkStoreNo);
        return ResultJson.ok();
    }
}
